package com.skstudio.reportview;

import com.skstudio.report.ReportBattery;
import com.skstudio.report.SpyData;

public class ReporterBattery extends ReportViewController {

    ReportBattery mBattery = null;

    @Override
    public void setSpyData(SpyData ref) {
        super.setSpyData(ref);
        mBattery = ref.getReportBattery();
    }

    @Override
    public int getReportRows() {
        return 1;
    }

    @Override
    public int getReportColumns() {
        return mBattery.mDataList.size();
    }

    @Override
    public int getEntry(int row, int col) {
        if (row == 0 && mBattery.mDataList.size() > col) {
            return (int) mBattery.mDataList.get(col).getLevel();
        }
        return 0;
    }

    @Override
    public String getReportDescription() {
        return "Battery Level";
    }

    @Override
    public String getEntryName(int row) {
        switch (row) {
            case 0:
                return "The current battery level";
        }
        return null;
    }

    @Override
    public String getEntryHint(int col) {
        if (mBattery.mDataList.size() > col) {
            ReportBattery.DataBattery dc = mBattery.mDataList.get(col);
            String hint = String.format("Current temperature %d Celcius, voltage %d", dc.mTemperature / 10, dc.mVoltage);
            return hint;
        }
        return null;
    }
}
